#ifndef GAME_VIEW_H
#define GAME_VIEW_H

#include <QWidget>
#include <QDebug>
#include <QMessageBox>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QtDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QPair>
#include <QMessageBox>

#include "choose_hero.h"
#include "sqloperator.h"
#include "rest.h"
namespace Ui {
class game_view;
}

class game_view : public QWidget
{
    Q_OBJECT

public:
    Ui::game_view *ui;
    explicit game_view(QWidget *parent = nullptr);
    ~game_view();

    QString gearName;

    void updateMonsterUI1(const QString &name, int value);
    void updateMonsterUI2(const QString &name, int value);
    QList<QVariantList> getMonsterData(int totalCount);
    int getMonsterCount();


signals:
    void goTostartgame();
    void rest();

public slots:
    void on_return_2_clicked();
    void fight1();
    void fight2();
    void upDateUI();
    void updateHeroValueLabel(const QString& heroName);

private:

    SqlOperator * sqloperator;
    choose_hero * choose;
    class rest * update;
    int m_heroTotalValue;
    int gearCount;

    QString heroName;


    int getGearCount();
    bool connectDatabase(const QString& dbName, const QString& connectionName);
    void closeData();
    void addPack(QString heroname);
    void updatestart();

    QString getgear(int &gearCount);

};


#endif

